/*
 * @Author: szx
 * @Date: 2022-02-26 12:22:35
 * @LastEditTime: 2022-02-26 12:31:14
 * @Description:
 * @FilePath: \leetcode\2000-2099\2016\2016.js
 */
/**
 * @param {number[]} nums
 * @return {number}
 */
var maximumDifference = function (nums) {
    let min = Number.MAX_SAFE_INTEGER;
    let res = -1;
    for (let i of nums) {
        min = Math.min(i, min);
        res = Math.max(i - min, res);
    }
    if (res == 0) return -1;
    return res;
};
